package com.dotools.privacy;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.text.TextPaint;
import android.text.style.ClickableSpan;
import android.view.View;

/**
 * author : joker
 * e-mail : wangbo@idotools.com
 * date   : 2019/12/24  13:45
 * desc   :
 */
public class ClickText extends ClickableSpan {
    private Context context;
    boolean isY=false;



    public ClickText(Context context ,boolean isY) {
        this.context = context;
        this.isY=isY;
    }

    @Override
    public void updateDrawState(TextPaint ds) {
        super.updateDrawState(ds);
        //设置文本的颜色
        ds.setColor(Color.BLUE);
        //超链接形式的下划线，false 表示不显示下划线，true表示显示下划线
        ds.setUnderlineText(true);
    }

    @Override
    public void onClick(View widget) {
        if (isY){
            context.startActivity(new Intent(context, AgreementActivity.class));
        }else{
            context.startActivity(new Intent(context,PrivacyPolicyActivity.class));
        }

    }
}
